package com.tjetc.util.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "minio")
@Data
public class MinioConfig {
    private String url;
    private String accessKey;
    private String secretKey;
    private String bucketName;

    @Bean
    public MinioClient minioClient(){
        //构建minio客户端 注入到容器
        MinioClient minioClient =
                MinioClient.builder().endpoint(url)
                        .credentials(accessKey, secretKey).build();
        return minioClient;
    }
}
